<template>
  <el-tree
    :data="rightsTreeList"
    show-checkbox
    node-key="id"
    :default-expanded-keys="rids"
    :default-checked-keys="newArr"
    :props="defaultProps"
    @check="handleCheckChange"
  />
</template>

<script>
import { logger } from 'runjs/lib/common'
// import { editEmpowerTree } from '@/api/authority'
export default {
  // 所有权限列表
  props: {
    rightsTreeList: {
      type: Array,
      required: true
    },
    newArr: {
      type: Array,
      required: true
    }

  },
  data() {
    return {
      defaultProps: {
        children: 'children',
        label: 'authName'
      },

      rids: []
    }
  },

  created() {
    this.onload
  },

  methods: {
  // 点击每一项获取每一项的id  并传给父组件
    handleCheckChange(data, checkedData) {
      this.rids = checkedData.checkedKeys
      this.$emit('clickRid', this.rids)
    }

  }
}
</script>

<style scoped lang='less'>

</style>
